<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="p"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>菜单选择</title>
	
	<script>
	function ok(){
		var nodes=$("#tree").dynatree("getTree").getSelectedNodes();
		for(i=0;i<nodes.length;i++){
		alert(nodes[i].data.key+":"+nodes[i].data.title);
		}
	}
	</script>
  </head>
  <body>
    <%
    String root=request.getParameter("menuId");if(root==null)root="000";
    String type=request.getParameter("type");
     %>
    
    <script type='text/javascript'>
		$(function(){
			$("#tree").dynatree({
				rootVisible: false,
				checkbox: true,
				<%if(!"checkbox".equals(type)){%>
				classNames: {checkbox: "ui-dynatree-radio"},
				selectMode: 1,
				<%}else{%>
				selectMode: 3,
				<%}%>
				initAjax: { 
	                url: "/platform/menu/MenuTreeJson.json?lazy=false&nodeId=<%=root%>" 
					},
				onActivate: function(dtnode){
					treeclick(dtnode);
				}
				
			});
		});
	</script>
    <div id="tree"></div>
    <input type="button" value="ok" onclick="ok();">
  </body>
</html>
